package com.lifesting.book.wci;

import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.Token;
import org.antlr.runtime.TokenStream;
import org.antlr.runtime.tree.CommonTreeAdaptor;

public class PascalNodeAdaptor extends CommonTreeAdaptor {
	 @Override 
	 public Object create(Token payload) {
         return new PascalNode(payload);
      }
      @Override 
      public Object dupNode(Object old) {
         return (old==null)? null : ((PascalNode)old).dupNode();
      }
      @Override 
      public Object errorNode(TokenStream input,
                                        Token start, Token stop,
                                        RecognitionException e) {
         return new PascalErrorNode(input, start, stop, e);
      }
      @Override
    public Token createToken(int tokenType, String text) {
    	return new PascalAntlrToken(tokenType, text);
    }
}
